package com.starinside.wp.domain;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * *******************************
 * Created by Tim.
 * form com.matt
 * on 2017/7/13
 * *******************************
 */
@Entity
@Data
@Table(name = "children_nursery_info_record")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class ChildrenNurseryInfoRecord extends Domain {

    @Id
    @Column(columnDefinition = "varchar(32) COMMENT 'id' ")
    private String id;

    @Column(columnDefinition = "varchar(50) COMMENT '宝宝id' ")
    private String childrenId;

    @Column(columnDefinition = "varchar(50) COMMENT '宝宝名称 （冗余）' ")
    private String childrenName;

    @Column(columnDefinition = "datetime default NOW() COMMENT '开始时间'", nullable = false)
    private Date beginDate = new Date();

    @Column(columnDefinition = "datetime default NOW() COMMENT '结束时间'", nullable = false)
    private Date endDate = new Date();

    @Column(columnDefinition = "int default 4 COMMENT  '状态 0，缺席（未签到），1，入园，2，离园，3，拒绝入园 4-请假' ")
    private Integer status;

    @Column(columnDefinition = "int default 0 COMMENT  '类型0普通记录,1延长合同,2入户扣课' ")
    private Integer type;

    @Column(columnDefinition = "int default 1 COMMENT  '影响天数' ")
    private Integer effectDay;

    @Column(columnDefinition = "int default 0 COMMENT  '初始剩余延长合同天数' ")
    private Integer surplusOriginalLeaveDay;

    @Column(columnDefinition = "int default 0 COMMENT  '剩余延长合同天数' ")
    private Integer surplusLeaveDay;

    @Column(columnDefinition = "datetime default NOW() COMMENT '初始合同结束日期' ")
    private Date nurseryOriginalEndDate = new Date();

    @Column(columnDefinition = "datetime default NOW() COMMENT '合同结束日期'")
    private Date nurseryEndDate = new Date();

    @Column(columnDefinition = "varchar(32)  COMMENT '创建人'")
    private String createdBy;

    @Column(columnDefinition = "varchar(32)  COMMENT '创建名称'")
    private String createdName;

    @ApiModelProperty(" varchar(255)  COMMENT '备注'")
    private String remark = "";
    
    public static ChildrenNurseryInfoRecord of(String childrenId, String childrenName, String createdBy, String createdName){
        ChildrenNurseryInfoRecord info = new ChildrenNurseryInfoRecord();
        info.setChildrenId(childrenId);
        info.setChildrenName(childrenName);
        info.setCreatedBy(createdBy);
        info.setCreatedName(createdName);
        return info;
    }
}
